/*
 * Decrypter.java  2009/5/20
 *
 * Copyright (c) 2009 Chin Shan Information Service Co., Ltd
 * All Rights Reserved.
 */
package ijournalimporter.util;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * Class description goes here.
 *
 * @version EquipFix 1.0
 *
 */
public class Decrypter {

    public static String decrypt(String str) {
        try {
            byte[] dec = new sun.misc.BASE64Decoder().decodeBuffer(str);
            // Decode using utf-8
            return demix(new String(dec, "UTF8"));
        } catch (Exception ex) {
            Logger.getLogger(Decrypter.class.getName()).log(Level.SEVERE, null, ex);
        }
        return null;
    }

    private static String demix(String str) {
        str = str.substring(2, str.length() - 3);
        return str;
    }
}
